﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CSharp.Study.AsyncTest
{
    public static class TaskWhen
    {
        public static void Go()
        {
            var result = GetTaskResultAsync().Result;
        }


        private static async Task<string[]> GetTaskResultAsync()
        {
            Task<string> task1 = File.ReadAllTextAsync("e:/VSTestFiles/1.txt");
            Task<string> task2 = File.ReadAllTextAsync("e:/VSTestFiles/2.txt");
            Task<string> task3 = File.ReadAllTextAsync("e:/VSTestFiles/3.txt");
            string[] result = await Task.WhenAll(task1, task2, task3);
            return result;
        }
    }
}
